﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PhotoManager.ascx.cs"
    Inherits="BONSAI.Admin.UC.PhotoManager" %>
<table cellpadding="0" cellspacing="0" width="100%" style="padding-top: 10px; padding-left: 5px;
    padding-right: 5px;">
    <tr>
        <td style="padding-left: 4px; padding-right: 4px;">
            <img src="Image2/lua.png" />
            <span style="font-weight: bold; font-size: 10pt;">SẢN PHẨM :
                <asp:Label ID="Label1" runat="server" Text=""></asp:Label></span>
           
                
            <hr />
        </td>
    </tr>
    <tr>
        <td align="left">
            <table cellpadding="0" cellspacing="0" style="width: 100%; margin-left: 5px;">
                <tr>
                    <td align="left" style="height: 40px; background-color: #f5f1ea;" class="tdfuncyion">
                        <asp:LinkButton ToolTip="Tạo mới ảnh." CssClass="functionAS" ID="lbcreate" runat="server"
                            OnClick="lbcreate_Click"><img  alt=""  style="border: 0px;vertical-align: middle;" src="ImageAdmin/add_create.png" /> &nbsp;Tạo mới</asp:LinkButton>
                        &nbsp; &nbsp;
                        <%--<img alt="" style="border: 0px; vertical-align: middle;" src="ImageAdmin/Delete.png" />
                        <a href="#" title="Chọn checkbox 'Chọn tất cả', sau đó click chức năng này để xóa tất cả nội dung."
                            class="functionAS" style="cursor: pointer;" onclick="DeleteAllV2()">Xóa tất cả</a>--%>
                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <img style="border: 0px; vertical-align: middle;" src="ImageAdmin/misc_21.png" />&nbsp;&nbsp;<a
                                href="ProductsManager.aspx" class="trovedanhsach">Trở về danh sách Sp</a>
                    </td>
                   
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td style="height: 10px;">
        </td>
    </tr>
    <tr>
        <td valign="top" align="left">
            <fieldset>
                <legend style="color: Blue;font-weight:bold;">DANH SÁCH ẢNH</legend>
                <br />
                <asp:GridView Width="100%" ID="GridView1" runat="server" AutoGenerateColumns="False"
                    CellPadding="4" ForeColor="Black" EmptyDataText="Không tìm thấy dữ liệu !" DataKeyNames="PhotosID"
                    BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
                    AllowPaging="True" PageSize="20" OnPageIndexChanging="GridView1_PageIndexChanging"
                    OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing">
                    <RowStyle HorizontalAlign="Left" />
                    <HeaderStyle HorizontalAlign="Left" />
                    <Columns>
                        <asp:TemplateField HeaderStyle-HorizontalAlign="Center" HeaderText="">
                            <HeaderTemplate>
                                <input id="changeCheckStateId" title="Chọn tất cả." onclick="changeCheckState(this.checked);"
                                    runat="server" type="checkbox" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <input disabled="disabled" type="checkbox" value='<%#Eval("PhotosID")%>' id="checkBox"
                                    runat="server" />
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="ID">
                            <ItemTemplate>
                                <span>
                                    <%#Eval("PhotosID")%>
                                </span>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Ảnh đại diện">
                            <ItemTemplate>
                                <span>
                                    <img alt="" style="height:150px;width:150px;" src='../Adminphoto/tours2/<%#Eval("thumbnail")%>' />
                                </span>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                        </asp:TemplateField>
                        
                        <asp:CommandField HeaderImageUrl="~/Admin/ImageAdmin/icon2.png" EditText="Chỉnh sửa" ShowEditButton="True" />
                        <asp:TemplateField ShowHeader="False">
                            <HeaderTemplate>
                               <img style="width:20px;height:20px;" src="ImageAdmin/edit-cut.png" />
                           </HeaderTemplate>
                            <ItemTemplate>
                                <asp:LinkButton OnClientClick="return ConformDelete()" ID="LinkButton1" runat="server"
                                    CausesValidation="False" CommandName="Delete" Text="Xóa"></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
                    <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
                    <HeaderStyle BackColor="Gray" Font-Bold="True" ForeColor="White" HorizontalAlign="Left" />
                    <AlternatingRowStyle HorizontalAlign="Left" />
                </asp:GridView>
            </fieldset>
        </td>
    </tr>
</table>
<input type="hidden" id="hdc" value="false" />

<script language="javascript" type="text/jscript">
    function ConformDeleteTC()
    {
       var ch = document.getElementById("hdc");
       if(ch.value=="false")
       {
          alert("Bạn phải chọn nội dung muốn xóa.");
          return false;
       }       
       return window.confirm("Bạn có chắc bạn muốn xóa tất cả nội dung này không?");
    }
</script>

<script language="javascript" type="text/javascript">
    function GetParaPT( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS ); 
    var results = regex.exec( window.location.href );
    if( results == null ) 
       return ""; 
    else    return results[1];
}
    function DeleteAllV2()
    {
        
       var ch = document.getElementById("hdc");
       
       if(ch.value=="false")
       {
          alert("Bạn phải chọn nội dung muốn xóa.");
          //return cancelEvent();
       }       
       else
       {
             
             if(window.confirm("Bạn có chắc bạn muốn xóa tất cả nội dung này không?")==true)
             {                 
               
                 var id;
                  id = GetParaPT('id');                              
                  location.href = "PhotoManager.aspx?zxc=qwertyuiop";
             }                  
        }
    }
    
</script>

